<!--
*Author：富行天下团队

 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/Mall/Mall_procure_task.js此处编写
 -->
<template>
  <div>
    <view-grid
      ref="grid"
      :columns="columns"
      :detail="detail"
      :editFormFields="editFormFields"
      :editFormFileds="editFormFields"
      :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields"
      :searchFormFileds="searchFormFields"
      :searchFormOptions="searchFormOptions"
      :table="table"
      :extend="extend"
    ></view-grid>
  </div>
</template>

<script>
import extend from "@/extension/mall/Mall_procure_task.js";
import ViewGrid from "@/components/basic/ViewGrid.vue";
var vueParam = {
  components: {
    ViewGrid,
  },
  data() {
    return {
      table: {
        key: "id",
        footer: "Foots",
        cnName: "采购任务调度",
        name: "Mall_procure_task",
        url: "/Mall_procure_task/",
        sortName: "id"
      },
      extend: extend,
      editFormFields: {
        scenic_name: "",
        // scenic_poiId: "",
        supplierCode: "",
        goods_id: "",
        goodcode: "",
        price: '',
        timeContainer: [],
        producttype: '',
        remark: "",
        goods_name: "",
        reservationTime: "",
        phone: "",
        stock: "",
        isdisable: 1,
        minSeconds: 1,
        maxSeconds: 0,
        merchantName: "",
        merchantCode: "",
        status: -1,
        productid: '',
      },
      editFormOptions: [
        [
          {
            title: "采购供应商",
            field: "supplierCode",
            type: "select",
            clearable:false,
            dataKey: "distributorList",
            data: [],
            required: true,
            colSize: 6,
          },
        ],
        [
          {
            title: "预约日期",
            field: "reservationTime",
            type: "date",
            min: new Date().getTime() - 1000 * 60 * 60 * 24,
            required: true
          },
          {
            title: "手机号",
            field: "phone",
            type: "phone",
            required: true,
          },
        ],
        [
          {
            title: "产品类型",
            required: true,
            field: "producttype",
            type: "cascaderEl",
            dataKey: "",
            orginData: [],
            data: [],
            multiple: false,
          },
          {
            title: "商品名称",
            field: "productid",
            type: "select",
            data: [],
            disabled: true,
            required: true,
            onChange:(e,item)=>{
              item.data.forEach((i)=>{
                if(i.goods_id==e){
                  this.editFormFields.goods_id=i.goods_id
                  this.editFormFields.goods_name=i.goods_name
                  this.editFormFields.goodcode=i.goodcode
                }
              })
            }
          },
        ],
        [
          {
            title: "秒数起",
            required: true,
            field: "minSeconds",
            type: "inpNum",
            min: 1,
            max: 59,
            step: 1,
            change: true,
            onChange: num => {
              if (num >= this.editFormFields.maxSeconds) {
                this.editFormFields.maxSeconds = num + 1;
              }
            }
          },
          {
            title: "秒数止",
            required: true,
            field: "maxSeconds",
            type: "inpNum",
            min: 2,
            max: 60,
            step: 1,
            change: true,
            onChange: num => {
              if (num < this.editFormFields.minSeconds) {
                this.editFormFields.maxSeconds = this.editFormFields.minSeconds + 1;
              }
            }
          }
        ],
        [
          {
            title: "任务时间",
            required: true,
            field: "timeContainer",
            type: "datetime",
            range: true,
            colSize: 9
          }
        ],
        [
          {
            dataKey: "enable",
            data: [],
            title: "是否启用",
            required: true,
            field: "isdisable",
            type: "switch"
          }
        ],
        [{ title: "备注", field: "remark", colSize: 12, type: "textarea" }]
      ],
      searchFormFields: {
        supplierCode: "",
        // scenic_poiId: "",
        goods_name: ""
      },
      searchFormOptions: [
        [
          {
            title: "商品名称",
            field: "goods_name",
            type: "text",
            type: "like"
          },
          // {
          //   dataKey: "scenic",
          //   data: [],
          //   title: "景区",
          //   field: "scenic_poiId",
          //   type: "select",
          // },
          {
            dataKey: "distributorList",
            data: [],
            title: "采购供应商",
            field: "supplierCode",
            type: "select"
          },
          {
            dataKey: "enable",
            data: [],
            title: "是否启用",
            field: "isdisable",
            type: "select"
          }
        ],
        [
          {
            dataKey: "scenic",
            data: [],
            title: "手机号",
            field: "phone",
            type: "select",
            type: "like"
          },
        ]
      ],
      columns: [
        {
          field: "id",
          title: "id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true
        },
        {
          field: "supplierCode",
          title: "采购供应商",
          type: "select",
          width: 120,
          bind: { key: "distributorList", data: [] }
        },
        // {field:'scenic_poiId',title:'景区编号',type:'string',width:220},
        {
          field: "scenic_poiId",
          title: "景区",
          type: "select",
          width: 120,
          hidden: true,
          bind: { key: "scenic", data: [] }
        },
        // {field:'goods_id',title:'商品id',type:'string',width:220},
        { field: "goods_name", title: "商品名称", type: "string", width: 150 },
        {
          field: "reservationTime",
          title: "预约时间",
          type: "string",
          width: 100
        },
        // {field:'phone',title:'手机号',type:'string',width:150},
        // {field:'stock',title:'库存',type:'string',width:80},
        // {field:'nowstock',title:'剩余库存',type:'string',width:90},
        {
          field: "isdisable",
          title: "是否启用",
          type: "select",
          width: 90,
          bind: { key: "enable", data: [] }
        },
        // {field:'intervalTime',title:'间隔时间秒',type:'int',width:100,align:'center'},
        {
          field: "startTime",
          title: "任务开始时间",
          type: "datetime",
          sortable: true,
          width: 160
        },
        {
          field: "endTime",
          title: "任务结束时间",
          type: "datetime",
          sortable: true,
          width: 160
        },
        { field: "remark", title: "备注", type: "string" },
        { field: "modifier", title: "修改人", type: "string" },
        // {field:'modifyDate',title:'修改时间',type:'datetime',sortable:true},
        // {field:'modifyID',title:'修改人ID',type:'int',hidden:true},
        // {field:'createDate',title:'创建时间',type:'datetime',sortable:true},
        // {field:'createID',title:'创建人ID',type:'int',hidden:true},
        { field: "creator", title: "创建人", type: "string" },
        // {field:'merchantCode',title:'商户编码',type:'string',width:220},
        { field: "merchantName", title: "商户名称", type: "string" }
      ],
      detail: {
        cnName: "#detailCnName",
        columns: [],
        sortName: "",
        key: ""
      },
    };
  },
};
export default vueParam;
</script>
